<template>
  <div class="foo">
    <div v-for="item in data" :key="item._id" class="main">
      <img :src="item.imgUrl" class="tit" />
      <h5>{{ item.title }}</h5>
      <p>{{ item.con }}</p>
      <div class="msg">
        <div>
          <img :src="item.headPic" />
          <span>{{ item.shopName }}</span>
        </div>
        <div>
          <img src="../../../public/images/index/dianzan.png" class="praise" />
          <span>{{ item.good }}</span>
          <img src="../../../public/images/index/pinglun.png" class="comment" />
          <span>{{ item.comment }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { useStore } from "vuex";
import { computed, onMounted } from "vue";
export default {
  setup() {
    const store = useStore();
    const data = computed(() => store.state.article.article);
    onMounted(() => {
      store.dispatch("getArticleData");
    });
    return {
      data,
    };
  },
};
</script>

<style lang="less" scoped>
.foo {
  margin-bottom: 30px;
}
.main {
  padding: 0 14px;
  margin-top: 20px;
  .tit {
    display: block;
    width: 344px;
    height: 151px;
    margin: 0 auto;
  }
  h5 {
    font-size: 19px;
    margin-top: 10px;
  }
  p {
    font-size: 12px;
    line-height: 34px;
  }
  .msg {
    display: flex;
    justify-content: space-between;
    div {
      display: flex;
      align-items: center;
    }
    span {
      font-size: 12px;
      margin: 0 20px 0 5px;
    }
    img {
      width: 27px;
      height: 27px;
    }
    .praise {
      width: 16px;
      height: 17px;
    }
    .comment {
      width: 17px;
      height: 17px;
    }
  }
}
</style>
